package ter.find.pattern.gui;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.GridLayout;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.BoxLayout;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;

import com.ter.Form;

import ter.find.pattern.ModelCharge;
import ter.find.pattern.ModelMotif;
public class WorkPanel extends JPanel {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	FindPanel panelfind;
	LireFichierXLS panelcharge;
	ChangeForm panelchange;
	JPanel panelagrege;
	Form formPanel;
	
	
	public WorkPanel(ControlPanel c,ChangeForm cp,Form f,LireFichierXLS l) {
		// TODO Auto-generated constructor stub
		setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
		ImageIcon icon = new ImageIcon("icon//angrenage.png");
		this.setBackground(Color.black);
		JTabbedPane workPanel = new JTabbedPane();
		
		panelcharge = l;
		workPanel.addTab("Chargement Data", icon, panelcharge, "Données");
		workPanel.setSelectedIndex(0);
		
		formPanel=f;
		workPanel.addTab("Discrétisation Data", icon, formPanel,"Discrétisation");
		
		panelchange=cp;
		workPanel.addTab("Changement de Forme", icon, panelchange, "Symboles");
		
		
		panelfind=new FindPanel();
		workPanel.addTab("Recherche Motif", icon, panelfind,"Motifs");
		
		
		add(workPanel);
	}
	
	protected JPanel createInnerPanel(String text) {
		JPanel jplPanel = new JPanel();
		JLabel jlbDisplay = new JLabel(text);
		jlbDisplay.setHorizontalAlignment(JLabel.CENTER);
		jplPanel.setLayout(new GridLayout(1, 1));
		jplPanel.add(jlbDisplay);
		return jplPanel;
	}
	
	public static void main(String[] args) {
		JFrame frame = new JFrame("TabbedPane Source Demo");
		frame.addWindowListener(new WindowAdapter() {

			public void windowClosing(WindowEvent e) {
				System.exit(0);
			}
		});
		new ModelMotif();
		new ModelCharge();
		Form f=new Form();
		LireFichierXLS l=new LireFichierXLS();
		//MotifPanel mp=new MotifPanel();
		ControlPanel c=new ControlPanel();
		ChangeForm cp=new ChangeForm();
		//InterfaceEngine i=new InterfaceEngine(c, m);
		frame.getContentPane().add(new WorkPanel(c,cp,f,l),
				BorderLayout.CENTER);
		frame.setSize(400, 125);
		frame.setVisible(true);
	}


}
